package com.atguigu.system.controller;

import com.atguigu.common.result.Result;
import com.atguigu.model.system.SysLoginLog;
import com.atguigu.model.system.SysRole;
import com.atguigu.model.vo.loginlog.SysLoginLogQueryReqVo;
import com.atguigu.model.vo.loginlog.SysLoginLogQueryRespVo;
import com.atguigu.system.service.SysLoginLogServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * SysLoginLogController
 * </p>
 *
 * @author flyduck
 * @since 2023/10/26
 */
@Api(value = "SysLoginLog管理", tags = "SysLoginLog管理")
@RestController
@RequestMapping(value="/admin/system/sysLoginLog")
public class SysLoginLogController {

    @Autowired
    private SysLoginLogServiceImpl sysLoginLogService;

    @ApiOperation(value = "获取分页列表")
    @GetMapping("{page}/{limit}")
    public Result getPageList(@PathVariable("page") Long page,
                              @PathVariable("limit") Long limit,
                              SysLoginLogQueryReqVo reqVo){
        Page<SysLoginLog> pageParam = new Page<>(page, limit);
        IPage<SysLoginLogQueryRespVo> pageModel = sysLoginLogService.getPageList(pageParam,reqVo);
        return Result.ok(pageModel);
    }
}
